package team.szm.scd;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import team.szm.scd.utils.EnvUtils;

import javax.annotation.Resource;
import java.lang.reflect.Field;

@SpringBootApplication
@MapperScan({"team.szm.scd.database.mapper"})
@Slf4j
public class SoftwareCourseDesignApplication implements InitializingBean {

    @Resource
    private Environment environment;

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(SoftwareCourseDesignApplication.class);
        app.setBannerMode(Banner.Mode.OFF);//关闭启动时的横幅
        log.trace("正在启动服务器");
        app.run(args);
        log.trace("服务器已经启动");
    }

    @Override
    public void afterPropertiesSet() {
        EnvUtils.setEnv(environment);
    }

}
